
<%@taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>


	<script>
		jQuery.validator.addMethod("notEqual", function(value, element, param) {
		  return this.optional(element) || value != $(param).val();
		}, "Please specify a different password");

		$(document).ready(function(){	
			$("#changePasswordForm").validate({
				rules: {
					password: {
						required: true
					},
					newPassword: {
						required: true,
						notEqual: '#password'
					},
					confirmPassword: {
						required: true,
						equalTo: '#newPassword'
					}
				}
			});
		});
		
	</script>	
<div id="changePasswordDiv">   
	<form:form name="changePasswordForm" id="changePasswordForm" action="changePassword.do" method="post" modelAttribute="user">
		<form:hidden path="loginName"/>
		<table>
			<tr class="row">
		  		<td class="label">&nbsp;</td>
		  	    <td class="input-field" colspan="2">
		  	    	<%@ include file="/common/messages.jsp" %>
		  	    </td>
			</tr>
				<tr class="row">
		   	    <td class="label"><spring:message code="changePassword.label.password"/></td>
		   	    <td class="input-field"><form:password id="password" path="password" cssClass="input-full-width" /></td>
		  	    <td><form:errors path="password" cssClass="error"/></td>
		 	</tr>
		   	<tr class="row">
		   	    <td class="label"><spring:message code="changePassword.label.newPassword"/></td>
		   	    <td class="input-field"><form:password id="newPassword" path="newPassword" cssClass="input-full-width" /></td>
		  	    <td><form:errors path="newPassword" cssClass="error"/></td>
		 	</tr>
		 	<tr class="row">
		   	    <td class="label"><spring:message code="changePassword.label.confirmPassword"/></td>
		   	    <td class="input-field"><form:password path="confirmPassword" cssClass="input-full-width" /></td>
		  	    <td><form:errors path="confirmPassword" cssClass="error"/></td>
		 	</tr>
		 	<tr class="row">
		 	   	<td class="label"> &nbsp; </td>
		   		<td class="input-field">
		   			<sj:submit id="changePasswordFormSubmit" target="changePasswordDiv" key="changePassword.button.save" validate="true" />		   			
		   		</td>
		   		<td> &nbsp; </td>
		   	</tr>
		</table>     
	</form:form>
</div>